package com.resource.authoritymanage.config;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.resource.authoritymanage.entity.TIdentifyRecordEntityExcel;
import com.resource.authoritymanage.entity.TTeacherInformationEntity;
import com.resource.authoritymanage.entity.TTeacherInformationEntityExcel;
import com.resource.authoritymanage.mapper.TIdentifyRecordDao;
import com.resource.authoritymanage.mapper.TTeacherInformationDao;

public class TTeacherInformationListener extends AnalysisEventListener<TTeacherInformationEntityExcel> {

    private TTeacherInformationDao tTeacherInformationDao ;
    public TTeacherInformationListener(TTeacherInformationDao tTeacherInformationDao) {
        this.tTeacherInformationDao = tTeacherInformationDao;
    }

    @Override
    public void invoke(TTeacherInformationEntityExcel data, AnalysisContext context) {
        TTeacherInformationEntity tTeacherInformationEntity = new TTeacherInformationEntity();
        tTeacherInformationEntity.setTeacherCode(data.getTeacherCode());
        tTeacherInformationEntity.setTeacherName(data.getTeacherName());
        tTeacherInformationEntity.setTeacherAge(data.getTeacherAge());
        tTeacherInformationEntity.setTeacherSex(data.getTeacherSex());
        tTeacherInformationEntity.setTeachingCourseCode(data.getTeachingCourseCode());
        tTeacherInformationEntity.setTeachingCourseName(data.getTeachingCourseName());
        tTeacherInformationDao.insert(tTeacherInformationEntity);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {

    }
}
